/*
package com.xzp.bams.client;

import javax.swing.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

*/
/**
 * @TODO
 * @Author xu
 * 2025/4/8
 *//*

public class BankClient {
    private static final String SERVER_ADDRESS = "localhost";
    private static final int SERVER_PORT = 8080;

    public static void main(String[] args) {
        // 创建简单的登录界面
        JFrame frame = new JFrame("ATM 登录");
        JPanel panel = new JPanel();
        JLabel userLabel = new JLabel("用户名:");
        JTextField userText = new JTextField(20);
        JLabel passwordLabel = new JLabel("密码:");
        JPasswordField passwordText = new JPasswordField(20);
        JButton loginButton = new JButton("登录");

        panel.add(userLabel);
        panel.add(userText);
        panel.add(passwordLabel);
        panel.add(passwordText);
        panel.add(loginButton);
        frame.add(panel);
        frame.setSize(300, 150);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);

        loginButton.addActionListener(e -> {
            String username = userText.getText();
            String password = new String(passwordText.getPassword());
            String response = sendLoginRequest(username, password);
            JOptionPane.showMessageDialog(frame, response);
        });
    }

    private static String sendLoginRequest(String username, String password) {
        try (Socket socket = new Socket(SERVER_ADDRESS, SERVER_PORT);
             PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
             BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()))) {

            String loginRequest = "LOGIN," + username + "," + password;
            out.println(loginRequest);

            return in.readLine();
        } catch (IOException e) {
            e.printStackTrace();
            return "登录失败: 无法连接到服务器";
        }
    }
}
*/
